package com.example.demo.service;

import com.example.demo.mapper.LogInfoMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Home-pc
 * Date: 2024-02-24
 * Time: 14:08
 */
@Slf4j
@Service
public class LogService {

    @Autowired
    private LogInfoMapper logInfoMapper;

    @Transactional(propagation = Propagation.REQUIRES_NEW)
    public Integer insertLog(String userName,String op){

         logInfoMapper.insert(userName,op);
         try{
             int a=10/0;
         } catch (Exception e) {
             throw e;
         }
         return 1;
    }
}
